<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">  
  <title>家具列表</title>
 </head>
 <body>
 
 <?php
  require_once('inc_admin.php');
  connect();
  //编写sql语句
  $sql = 'select * from jiaju';
  $result = fetch_array($sql); 
 ?>

 <center><h3>家具列表</h3></center>
 <table align="center" width="80%" border=1> 
 <tr>
   <th>编号</th>
   <th>图片</th>
   <th>名称</th> 
   <th>品牌</th> 
   <th>所属类别</th>   
   <th >添加时间</th>
   <th>操作</th>
 </tr>

 <?php
  foreach ($result as $row) {
   echo '<tr>';
   echo '<td>'.$row['xx_id'].'</td>';
   //echo '<td><img src='.UserPhotoPath.$row['xx_jiajulink'].' width=100 height=90 alt="无图片"></td>';
   echo '<td><a href="detail.php?id='.$row['xx_id'].' "><img src='.UserPhotoPath.$row['xx_jiajulink'].' width=100 height=90 alt="无图片"></a></td>';

   //echo '<td><a href="detail.php?id='.$row['xx_id'].' ">'.$row['xx_name'].'</a> </td>'; 
   echo '<td>'.$row['xx_name'].'</td>'; 
   echo '<td>'.$row['xx_brand'].'</td>';
   if($row['xx_cid']==1)
  {
    $row['xx_cid']='椅子';
  }
  if($row['xx_cid']==2)
  {
    $row['xx_cid']='桌子';
  }
  if($row['xx_cid']==3)
  {
    $row['xx_cid']='床';
  }
   echo '<td>'.$row['xx_cid'].'</td>';
   echo '<td>'.$row['xx_adddate'].'</td>';
   echo '<td><a href="jiajuEditForm.php?id='.$row['xx_id'].' ">修改</a> | 
   <a href="del.php?id='.$row['xx_id'].'" onClick="return confirm(\'确定要删除吗？\');">删除</a> | 
   <a href="verify.php?id='.$row['xx_id'].' ">审核</a></td>';

   echo '</tr>';  
  }
  echo '</table>';  
  $totalrows = count($result);
  echo "<table align='center'><tr><td>共有{$totalrows}种家具</td></tr></table>";   
 ?>
 
 </body>
</html>